#ifndef AIG_TYPE_H
#define AIG_TYPE_H 

#include <def.h>

//--- AigLit ------------------------------------------------------------------
typedef uint32_t AigLit;
inline AigLit   toAigLit( uint32_t var , unsigned sgn){return (var+var)+sgn;}
inline AigLit   inv ( AigLit p ){ return p ^ 1 ;}
inline unsigned sign( AigLit p ){ return p & 1 ;}
inline unsigned var ( AigLit p ){ return p >>1 ;}
//=============================================================================

//--- AigNode -----------------------------------------------------------------
/**
@brief basic atom constructing circuit

a aig node is a sorted pair of input 
do not construct this member without createAND or assign operator
*/
struct AigNode
{
   union
   {
      uint64_t key;
      AigLit fanin[2];
   };
   AigNode(){}
   inline AigNode( uint64_t a , AigLit b ):key( a<<32|b){}
};
//=============================================================================

#endif
